<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="emb.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/">
    
    <title>My JSP 'viewButton.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	--> 
	<%
	 response.setDateHeader("expires", 0);
	 String srr = (String)request.getParameter("token");
	 String sid=  (String)request.getParameter("idoc");
	 String realPath = request.getRealPath("/");
	 //System.out.println("token:"+srr);
	 //System.out.println("token:"+sid);
	 %>
	 <link href="css/box.css" rel="stylesheet" type="text/css" />
	 <script type="text/javascript" src="js/lightBox.js"></script>
	 <script type="text/javascript" src="js/lightBoxPart.js"></script>
<script type="text/javascript">
function testPath()
{
 alert('"<%=realPath %>"');
}
function testa()
 {
  var p;
	if(document.all){//IE
	p = document.frames["ifrChild1"].document;
	}else{//Firefox
	p = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	 alert("保存");
	// p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	 p.save("saveAS");
	 //p.Csave();
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
 }
 function test2()
 {
  var doc;
	if(document.all){//IE
	alert("IE");
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	alert("Firefox");
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	var resultValue = doc.body.innerHTML;
	
	alert(resultValue); 
	
 }
 function testb()
 {
  var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	 var p = document.frames["ifrChild1"].window;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("刷新");
	 p.Crefresh();
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
 }
 function testsdk()
 {
 var doc;
	if(document.all){//IE
	doc = document.frames["ifrChild1"].document;
	}else{//Firefox
	doc = document.getElementById("ifrChild1").contentDocument;
	}
	try{
	 var p = document.frames["ifrChild1"].window;
	//document.getElementById("cme").value=doc3.frames["dlg"].document.body.innerHTML;
	 alert("直接刷新");
	// p.Report.location="../BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/report.jsp?iViewerID=8&sEntry=we000f000019ea4a104386&iReport=0&iReportID=4&sPageMode=QuickDisplay&sReportMode=Viewing&iPage=1&zoom=100&isInteractive=true&isStructure=false&nbPage=NaN&sEmptyLab=%255BEMPTY_VALUE%255D";
     p.DlgFrame.location="http://172.17.79.14:8080/test1/jsp/prompts.jsp";
	 //p.resetStatesCB(); p.DS.bUndoableAction=true; p.saveStateCB();
     //p.eventManager.notify(p._EVT_PROCESS_QUICK_SAVE);
	}catch(e){alert("webi:err:"+e);}
}
 function testas()
 {
  alert("23");
  var querySave;
  var p = document.frames["ifrChild1"].window;
  var input1 = document.getElementById("inputid").value; 
  p.SecondDlgFrame.location="../BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/language/zh_CN/html/ajaxOpenOrSaveAsDialogSDK4.html?inputStr="+input1;
 
  //document.getElementById("cme").value=p.SecondDlgFrame.document.body.innerHTML;
  //
 }
 function UrlSave(url)
 {
  var p = document.frames["ifrChild1"].window;
  //alert("开始:"+url);
  p.DlgFrame.location="../BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/"+url;
 }
 
 function getVls(obj)
 {
		  for(var i=0; i<obj.length; i++)
		{
		   var pt=prompts[i];
		   //for(var j=0;j<pt.)
		}
 }
  function newFiless(objs)
  {
   setTimeout("updateId()",2000);
  }
  
  function testas1()
 {
  var p = document.frames["ifrChild1"].window;
   alert(p.strDocID);
 }
 function updateId()
 {
  var p = document.frames["ifrChild1"].window;
  try{
   if(p.strDocID=="undefined"||p.strDocID==undefined)
   {
       setTimeout("updateId()",2000);
   }else
   {
       alert(p.strDocID);
   }
  }catch(e){setTimeout("updateId()",2000);}
 }
 function NEWREF(vpro)
 {
  var	footerhtml1='<input type="image" alt="取消" src="box/cancel_button.gif"  class="btn" id="msg1cancel" />'
	+'<input type="image" alt="提交查询" src="box/ok_button.gif"  class="btn" id="msg1okBtn" />';
    var  htmlbody = getHtmls("1");
    Box("msg1",635,300,htmlbody,footerhtml1);
 }
 </script>
  </head>
  
  <body>
  <FORM name="LoginForm" action="view" method="post">
  	<TABLE>		
	<TR>
		<TD>
			测试页面按钮层：<input type="button" name="test1" value="测试1" onClick="test2()"/>
			<input type="button" name="test1" value="测试保存" onClick="testa()"/>
			<input type="button" name="test1" value="测试刷新" onClick="testb()"/>
			<input type="button" name="test1" value="路径" onClick="testPath()"/>
			<input type="button" name="" value="直接刷新" onClick="testsdk()">
			<input type="button" name="" value="另存为" onClick="testas()">
			<input type="button" name="" value="获取现在ID" onClick="testas1()"><input type = "text" id = "inputid"></TD>
			<!--<TD><textarea  id="cme" name="cme"></textarea></TD>
			
	--></TR></TABLE>
  <%
	String tokeTemp = "";
	//String[] tt= tokeTemp.split("@");
	//String sHomeURL = "http://172.17.79.14:8080/BOE/OpenDocument/opendoc/openDocument.jsp?token=" + srr + "&iDocID="+sid+"&ViewType=I";
	//String openUrl = "";
	/*
	http://172.17.79.14:8080/BOE/OpenDocument/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?id=4921
&ViewType=I
&actId=3990&pvl=zh_CN&bttoken=MDAwRGw2MFJGSDNbMFREbVhBZjFRQmFmST1FVEpeODAEQ
&loc=zh_CN&appKind=OpenDocument
&cafWebSesInit=true&bypassLatestInstance=true&isApplication=true
&service=%2FOpenDocument%2FappService.do&objIds=4921&appCUID=AZXgyG8_ue9OtYITUhGG.wg&containerId=4903
&pref=
maxOpageU%3D10%3BmaxOpageUt%3D200%3BmaxOpageC%3D10%3Btz%3DAsia%2FShanghai%3BmUnit%3Dinch%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dtrue%3B
&kind=Webi
&iventrystore=widtoken&entSession=CE_ENTERPRISESESSION&lang=zh_CN
	*/
	String url1 ="http://172.17.79.14:8080/BOE/CMC/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument3.jsp?"
	+"id="+sid
	+"&ViewType=I"
	+"&actId=3990"
	+"&pvl=zh_CN&loc=zh_CN"
	+"&bttoken="+srr
	+"&appKind=CMC"
	+"&cafWebSesInit=true"
	+"&bypassLatestInstance=true&showApply=true"
	+"&service=%2Fadmin%2FApp%2FappService.jsp"
	+"&objIds="+sid
	+"&&showSingleChildAction=true&containerId=4903&pref=maxOpageU%3D%3BmaxOpageUt%3D200%3BmaxOpageC%3D%3Btz%3DAsia%2FShanghai%3BmUnit%3D%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dfalse%3B"
	+"&kind=Webi"
	+"&iventrystore=widtoken"	
	+"&entSession=CE_ENTERPRISESESSION&lang=zh_CN";
	String url ="http://172.17.79.14:8080/BOE/OpenDocument/1308200853/AnalyticalReporting/webiDHTML/viewer/viewDocument.jsp?id=4921&ViewType=I&actId=3990&pvl=zh_CN&bttoken=MDAwRGw2MFJGSDNbMFREbVhBZjFRQmFmST1FVEpeODAEQ&loc=zh_CN&appKind=OpenDocument&cafWebSesInit=true&bypassLatestInstance=true&isApplication=true&service=%2FOpenDocument%2FappService.do&objIds=4921&appCUID=AZXgyG8_ue9OtYITUhGG.wg&containerId=4903&pref=maxOpageU%3D10%3BmaxOpageUt%3D200%3BmaxOpageC%3D10%3Btz%3DAsia%2FShanghai%3BmUnit%3Dinch%3BshowFilters%3Dtrue%3BsmtpFrom%3Dtrue%3BpromptForUnsavedData%3Dtrue%3B&kind=Webi&iventrystore=widtoken&ViewType=H&entSession=CE_ENTERPRISESESSION&lang=zh_CN"; %>
	<iframe id="ifrChild1" name="ifrChild1" src="<%=url1 %>" height="789" width="1024"></iframe>
</FORM>
  </body>
</html>
